<?php
/**
 * Created by PhpStorm.
 * User: liuxin
 * Date: 2018/8/24
 * Time: 下午7:24
 */

namespace common\models;

use Yii;

/**
 * This is the model class for table "advert".
 *
 * @property int $id
 * @property string $link
 * @property int $time
 * @property int $day
 * @property string $img
 * @property string $special_img
 * @property int $link_switch 1 开 2 关
 * @property int $ad_switch 1 开 2 关
 * @property int $type 1 ios 2 an
 * @property string $created
 * @property string $updated
 * @property string $operator
 */
class Advert extends \yii\db\ActiveRecord
{
    public $file;

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'advert';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
          [['link', 'time', 'day', 'img', 'special_img', 'type', 'operator'], 'required'],
          [['time', 'day', 'link_switch', 'ad_switch', 'type'], 'integer'],
          [['created', 'updated'], 'safe'],
          [['link', 'img', 'special_img'], 'string', 'max' => 225],
          [['operator'], 'string', 'max' => 45],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
          'id' => 'ID',
          'link' => '链接',
          'time' => '单次显示时长',
          'day' => '显示天数',
          'img' => '图片',
          'special_img' => '特殊图片',
          'link_switch' => '外链开关',
          'ad_switch' => '广告开关',
          'type' => 'Type',
          'created' => 'Created',
          'updated' => 'Updated',
          'operator' => 'Operator',
        ];
    }
}